﻿#include <iostream>

using namespace std;

class Solution
{
public:

    // 1047. 删除字符串中的所有相邻重复项
    string removeDuplicates(string s)
    {
        string ret;
        for (auto ch : s)
        {
            if (ret.size() && ret.back() == ch)
                ret.pop_back();
            else
                ret += ch;
        }
        return ret;
    }
};

int main()
{
    string s = "adveevdfrddrfasc";
    cout << Solution().removeDuplicates(s) << endl;

    return 0;
}